package com.xuzimian.globaldemo.designpatterns.proxy;


class RealSubjectProxy {
    private ISubject subject;

    public RealSubjectProxy(ISubject subject) {
        this.subject = subject;
    }

    public String processBusiness() {
        System.out.println("Before ...");

        String result = subject.processBusiness();

        System.out.println("After ...");
        return result;
    }

}

public class StaticProxyDemo {
    public static void main(String[] args) {
        new RealSubjectProxy(new ISubject() {
            @Override
            public String processBusiness() {
                System.out.println("Method processBusiness call by StaticProxyDemo");
                return null;
            }
        }).processBusiness();
    }
}
